import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebViewLogic extends GetxController {

  var pageTitle='';
  var webUrl='';

  var temp='';

  late WebViewController controller;

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    pageTitle=Get.arguments['pageTitle'];
    webUrl=Get.arguments['webUrl'];
    temp=Get.arguments['temp'];


    controller = WebViewController();
    controller.setJavaScriptMode(JavaScriptMode.unrestricted);
    controller.setNavigationDelegate(
      NavigationDelegate(onPageFinished: (url) async {}),
    );

    if(webUrl.isNotEmpty){
      LogUtil.v(webUrl, tag: 'WebView请求得地址=');
      controller.loadRequest(Uri.parse(webUrl));
    }else{
      LogUtil.v(temp, tag: '公告内容=');
    }

  }

  @override
  void onReady() {
    // TODO: implement onReady
    super.onReady();
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
  }
}
